//
//  SecondViewController.m
//  UI08_界面通信
//
//  Created by LGC on 16/3/18.
//  Copyright © 2016年 Apon. All rights reserved.
//

#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
#import "SecondViewController.h"

@interface SecondViewController ()

@property (nonatomic, retain) UILabel *label;
@property (nonatomic, retain) UIButton *button;

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self create];
    // Do any additional setup after loading the view.
}

- (void)create {
    self.label = [[UILabel alloc]initWithFrame:CGRectMake(100, 100, 200, 50)];
    self.label.backgroundColor = [UIColor yellowColor];
    self.label.text = self.contents;
    self.label.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.label];
    [_label release];
    
    self.button = [UIButton buttonWithType:UIButtonTypeSystem];
    self.button.frame =CGRectMake(0, 0, WIDTH / 9.f, HEIGHT / 10.f);
    self.button.backgroundColor = [UIColor yellowColor];
    self.button.center = self.view.center;
    [self.button setTitle:@"返回" forState:UIControlStateNormal];
    [self.button addTarget:self action:@selector(handleBack:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.button];
}

- (void)handleBack:(UIButton *)button {
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
